@extends('admin_system.layout.layout')
@section('content')
    <br>
    <div class="container-fluid" style="margin-bottom: 100px">
        <div class="list-group">
            <a href="#" class="list-group-item active">
                <h4 class="list-group-item-heading">文章列表</h4>
                <p class="list-group-item-text">列表页</p>
            </a>
        </div>

        <table class="table table-bordered table-hover">
            <thead>
            <tr>
                <th>ID</th>
                <th>类型</th>
                <th>标题</th>
                <th>文章缩略图</th>
                <th>文章的内容</th>
                <th>内容的简介</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            @foreach($data as $k=>$v)
            <tr>
                <td>{{$v->id}}</td>
                <td>{{$v->lessons_category_id}}</td>
                <td>{{str_limit($v->title,30)}}</td>
                <td>
                    <img src="{{$v->article_img}}" alt="" style="width: 200px">
                </td>
                <td style="width: 180px">{!! str_limit($v->body,200) !!}</td>
                <td>{!! str_limit($v->introduce,60) !!}</td>
                <td style="min-width: 60px;display: flex;justify-content: center;align-items: center">
                    <button type="button" class="btn btn-danger">
                        <a href="{{route('article_del',['id'=>$v->id])}}">删除</a>
                    </button>
                    <a href="{{route('article_edit',['id'=>$v->id])}}">
                        <button type="button" class="btn btn-info">编辑</button>
                    </a>
                </td>
            </tr>
            @endforeach
            </tbody>
        </table>
        {{$data->links()}}
        <div class="clearfix"></div>
        <a href="{{route('article_add')}}"><button type="button" class="btn btn-info col-md-3">添加</button></a>
    </div>
    <script>
        @if(session('article_success'))
        swal("Oops!", "{{session('article_success')}}!", "success")
        @endif
        @if(session('article_errors'))
        swal("Oops!", "{{session('article_errors')}}!", "error")
        @endif
    </script>
@stop